<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jeecms_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
</script>
<style type="text/css">
.items{padding-top:1px;}
</style>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos"><@s.m "global.position"/>: <@s.m "cmsVoteTopic.function"/> - <@s.m "global.add"/></div>
	<form class="ropt">
		<input type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='v_list.do';"/>
	</form>
	<div class="clear"></div>
</div>
<@p.form id="jvForm" action="o_save.do">
<@p.text label="cmsVoteTopic.title" name="title" required="true" class="required" style="width:400px" maxlength="255"/>
<@p.textarea label="cmsVoteTopic.description" name="description" rows="3" style="width:400px" maxlength="255"/>
<@p.td label="cmsVoteTopic.time">
<table>
	<tr>
		<td><@s.m "cmsVoteTopic.startTime"/></td>
		<td><input type="text" name="startTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/></td>
		<td rowspan="2" valign="middle"><span class="pn-fhelp"><@s.m "cmsVoteTopic.time.help"/></span></td>
	</tr>
	<tr>
		<td><@s.m "cmsVoteTopic.endTime"/></td>
		<td><input type="text" name="endTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate"/></td>
	<tr/>
</table>
</@p.td><@p.tr/>
<@p.text label="cmsVoteTopic.repeateHour" name="repeateHour" class="digits" maxlength="10" help="cmsVoteTopic.repeateHour.help"/>
<@p.radio label="cmsVoteTopic.restrictMember" name="restrictMember" value="false" list={"true":"global.true","false":"global.false"} help="cmsVoteTopic.restrictMember.help"/>
<@p.radio label="cmsVoteTopic.restrictIp" name="restrictIp" value="false" list={"true":"global.true","false":"global.false"}/>
<@p.radio label="cmsVoteTopic.restrictCookie" name="restrictCookie" value="true" list={"true":"global.true","false":"global.false"} help="cmsVoteTopic.restrictCookie.help"/>
<@p.td label="cmsVoteTopic.multiSelect" required="true">
<input type="text" name="multiSelect" value="1" class="required digits" style="width:100px"/>
<label style="padding-left:20px"><input type="checkbox" onclick="$('#def').val(this.checked);"/><@s.m "cmsVoteTopic.def"/><input type="hidden" id="def" name="def" value="false"/></label>
<label style="padding-left:10px"><input type="checkbox" onclick="$('#disabled').val(this.checked);"/><@s.m "cmsVoteTopic.disabled"/><input type="hidden" id="disabled" name="disabled" value="false"/></label>
</@p.td><@p.tr/>
<@p.td>
<div class="items">
	<@s.m "cmsVoteTopic.items"/>
&nbsp; <input type="button" value="<@s.m "cmsVoteItem.addLines"/>" onclick="addLines();"/>
</div>
<div id="itemsContainer">
<#list 0..4 as i>
<div class="items">
<@s.m "cmsVoteItem.title"/>: <input type="text" name="itemTitle" style="width:300px"/>
&nbsp; <@s.m "cmsVoteItem.voteCount"/>: <input type="text" name="itemVoteCount" value="0" style="width:50px"/>
&nbsp; <@s.m "cmsVoteItem.priority"/>: <input type="text" name="itemPriority" value="${i+1}" style="width:30px"/>
&nbsp; <input type="button" value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
</div>
</#list>
</div>
</@p.td><@p.tr/>
<@p.td><@p.submit code="global.submit"/> &nbsp; <@p.reset code="global.reset"/></@p.td>
</@p.form>
</div>

<textarea id="itemTpl" style="display:none;">
<div class="items">
<@s.m "cmsVoteItem.title"/>: <input type="text" name="itemTitle" style="width:300px"/>
&nbsp; <@s.m "cmsVoteItem.voteCount"/>: <input type="text" name="itemVoteCount" value="0" style="width:50px"/>
&nbsp; <@s.m "cmsVoteItem.priority"/>: <input type="text" name="itemPriority" value="{0}" style="width:30px"/>
&nbsp; <input type="button" value="<@s.m "global.delete"/>" onclick="$(this).parent().remove();"/>
</div>
</textarea>

<script type="text/javascript">
var tpl = $.format($("#itemTpl").val());
var index = 6;
function addLines() {
	$("#itemsContainer").append(tpl(index++));
}
</script>

</body>
</html>